package com.knight.hadoop.day04.mythread.thread.pool;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class ThreadPoolWithRunable {
	public static void main(String[] args) {
		ExecutorService executor =  Executors.newCachedThreadPool();
		
		for(int i=0;i<4;i++){
			executor.execute(new Runnable() {
				
				@Override
				public void run() {
					System.out.println("thread name: "+Thread.currentThread().getName());
					try {
						Thread.sleep(1000);
					} catch (InterruptedException e) {
						e.printStackTrace();
					}
				}
			});
		}
		executor.shutdown();
	}
}
